/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using System.Collections.Generic;
using NetProtocol.POD;
using NetProtocol.Enum;
using IQIGame.Onigao.Game;
using IQIGame.Onigao.GamePlay;
using IQIGame.Onigao.Framework;
using Cysharp.Threading.Tasks;
using System;
using static IQIGame.Onigao.Game.MessageWrapper;

namespace NetProtocol.Client {
	/// <summary>
	/// 中心服好友模块
	/// module : centerFriend
	/// </summary>
	public interface CNetCenterFriend : INetClientModule {
		
		public ISession GetSession();
	
		Dictionary<int, INetClientModule.Package2MessageWrapper> INetClientModule.GetModuleFunction()
        {
            MessageFunction removeFriendsResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<RemoveFriendsResultData>)wrapper;
                SC_removeFriendsResult(session, ref _wrapper.message);
                MessageWrapperPool<RemoveFriendsResultData>.Put(_wrapper);
            };
            MessageFunction applyFriendsResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<ApplyFriendsResultData>)wrapper;
                SC_applyFriendsResult(session, ref _wrapper.message);
                MessageWrapperPool<ApplyFriendsResultData>.Put(_wrapper);
            };
            MessageFunction dealWithApplyResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<DealWithApplyResultData>)wrapper;
                SC_dealWithApplyResult(session, ref _wrapper.message);
                MessageWrapperPool<DealWithApplyResultData>.Put(_wrapper);
            };
            MessageFunction addBlacklistResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<AddBlacklistResultData>)wrapper;
                SC_addBlacklistResult(session, ref _wrapper.message);
                MessageWrapperPool<AddBlacklistResultData>.Put(_wrapper);
            };
            MessageFunction removeBlacklistResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<RemoveBlacklistResultData>)wrapper;
                SC_removeBlacklistResult(session, ref _wrapper.message);
                MessageWrapperPool<RemoveBlacklistResultData>.Put(_wrapper);
            };
            MessageFunction searchPlayerResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<SearchPlayerResultData>)wrapper;
                SC_searchPlayerResult(session, ref _wrapper.message);
                MessageWrapperPool<SearchPlayerResultData>.Put(_wrapper);
            };
            MessageFunction setRemarkResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<SetRemarkResultData>)wrapper;
                SC_setRemarkResult(session, ref _wrapper.message);
                MessageWrapperPool<SetRemarkResultData>.Put(_wrapper);
            };
            MessageFunction recommendResult_Delegate = (session, wrapper) =>
            {
            	var _wrapper = (MessageWrapper<RecommendResultData>)wrapper;
                SC_recommendResult(session, ref _wrapper.message);
                MessageWrapperPool<RecommendResultData>.Put(_wrapper);
            };
            MessageFunction notifyAddFriend_Delegate = (session, wrapper) =>
            {
            var _wrapper = (MessageWrapper<NotifyAddFriendData>)wrapper; 
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.centerFriend_notifyAddFriend, "Recv->" + _wrapper.message.ToString());
#endif
                SC_notifyAddFriend(session, _wrapper.message.friends);
                MessageWrapperPool<NotifyAddFriendData>.Put(_wrapper);
            };
            MessageFunction notifyDeleteFriend_Delegate = (session, wrapper) =>
            {
            var _wrapper = (MessageWrapper<NotifyDeleteFriendData>)wrapper; 
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.centerFriend_notifyDeleteFriend, "Recv->" + _wrapper.message.ToString());
#endif
                SC_notifyDeleteFriend(session, _wrapper.message.ids);
                MessageWrapperPool<NotifyDeleteFriendData>.Put(_wrapper);
            };
            MessageFunction notifyUpdateFriend_Delegate = (session, wrapper) =>
            {
            var _wrapper = (MessageWrapper<NotifyUpdateFriendData>)wrapper; 
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.centerFriend_notifyUpdateFriend, "Recv->" + _wrapper.message.ToString());
#endif
                SC_notifyUpdateFriend(session, _wrapper.message.friends);
                MessageWrapperPool<NotifyUpdateFriendData>.Put(_wrapper);
            };
        
            Dictionary<int, INetClientModule.Package2MessageWrapper> retDic = new()
            {
                {NetMessageId.centerFriend_removeFriendsResult, (session, package) => {
                	var result = MessageWrapperPool<RemoveFriendsResultData>.Get();
                	result.Init(session, removeFriendsResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.centerFriend_applyFriendsResult, (session, package) => {
                	var result = MessageWrapperPool<ApplyFriendsResultData>.Get();
                	result.Init(session, applyFriendsResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.centerFriend_dealWithApplyResult, (session, package) => {
                	var result = MessageWrapperPool<DealWithApplyResultData>.Get();
                	result.Init(session, dealWithApplyResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.centerFriend_addBlacklistResult, (session, package) => {
                	var result = MessageWrapperPool<AddBlacklistResultData>.Get();
                	result.Init(session, addBlacklistResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.centerFriend_removeBlacklistResult, (session, package) => {
                	var result = MessageWrapperPool<RemoveBlacklistResultData>.Get();
                	result.Init(session, removeBlacklistResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.centerFriend_searchPlayerResult, (session, package) => {
                	var result = MessageWrapperPool<SearchPlayerResultData>.Get();
                	result.Init(session, searchPlayerResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.centerFriend_setRemarkResult, (session, package) => {
                	var result = MessageWrapperPool<SetRemarkResultData>.Get();
                	result.Init(session, setRemarkResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.centerFriend_recommendResult, (session, package) => {
                	var result = MessageWrapperPool<RecommendResultData>.Get();
                	result.Init(session, recommendResult_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.centerFriend_notifyAddFriend, (session, package) => {
                	var result = MessageWrapperPool<NotifyAddFriendData>.Get();
                	result.Init(session, notifyAddFriend_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.centerFriend_notifyDeleteFriend, (session, package) => {
                	var result = MessageWrapperPool<NotifyDeleteFriendData>.Get();
                	result.Init(session, notifyDeleteFriend_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
                {NetMessageId.centerFriend_notifyUpdateFriend, (session, package) => {
                	var result = MessageWrapperPool<NotifyUpdateFriendData>.Get();
                	result.Init(session, notifyUpdateFriend_Delegate);
                	result.FromPackage(package);
                	return result;
                }},
            };
            return retDic;
        }
#region Client-side Interface
		/// <summary>
        /// 
        /// </summary>
		public void SC_removeFriendsResult(ISession session, ref RemoveFriendsResultData message) 
		{
            _SC_removeFriendsResult(session, ref message);
		}
		
		public void _SC_removeFriendsResult(ISession session, ref RemoveFriendsResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.centerFriend_removeFriendsResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.centerFriend_removeFriendsResult, message.code);
			MsgAsyncAwaiter<RemoveFriendsResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        /// 
        /// </summary>
		public void SC_applyFriendsResult(ISession session, ref ApplyFriendsResultData message) 
		{
            _SC_applyFriendsResult(session, ref message);
		}
		
		public void _SC_applyFriendsResult(ISession session, ref ApplyFriendsResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.centerFriend_applyFriendsResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.centerFriend_applyFriendsResult, message.code);
			MsgAsyncAwaiter<ApplyFriendsResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        /// 
        /// </summary>
		public void SC_dealWithApplyResult(ISession session, ref DealWithApplyResultData message) 
		{
            _SC_dealWithApplyResult(session, ref message);
		}
		
		public void _SC_dealWithApplyResult(ISession session, ref DealWithApplyResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.centerFriend_dealWithApplyResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.centerFriend_dealWithApplyResult, message.code);
			MsgAsyncAwaiter<DealWithApplyResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        /// 
        /// </summary>
		public void SC_addBlacklistResult(ISession session, ref AddBlacklistResultData message) 
		{
            _SC_addBlacklistResult(session, ref message);
		}
		
		public void _SC_addBlacklistResult(ISession session, ref AddBlacklistResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.centerFriend_addBlacklistResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.centerFriend_addBlacklistResult, message.code);
			MsgAsyncAwaiter<AddBlacklistResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        /// 
        /// </summary>
		public void SC_removeBlacklistResult(ISession session, ref RemoveBlacklistResultData message) 
		{
            _SC_removeBlacklistResult(session, ref message);
		}
		
		public void _SC_removeBlacklistResult(ISession session, ref RemoveBlacklistResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.centerFriend_removeBlacklistResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.centerFriend_removeBlacklistResult, message.code);
			MsgAsyncAwaiter<RemoveBlacklistResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        /// 
        /// </summary>
		public void SC_searchPlayerResult(ISession session, ref SearchPlayerResultData message) 
		{
            _SC_searchPlayerResult(session, ref message);
		}
		
		public void _SC_searchPlayerResult(ISession session, ref SearchPlayerResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.centerFriend_searchPlayerResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.centerFriend_searchPlayerResult, message.code);
			MsgAsyncAwaiter<SearchPlayerResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        /// 
        /// </summary>
		public void SC_setRemarkResult(ISession session, ref SetRemarkResultData message) 
		{
            _SC_setRemarkResult(session, ref message);
		}
		
		public void _SC_setRemarkResult(ISession session, ref SetRemarkResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.centerFriend_setRemarkResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.centerFriend_setRemarkResult, message.code);
			MsgAsyncAwaiter<SetRemarkResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        /// 
        /// </summary>
		public void SC_recommendResult(ISession session, ref RecommendResultData message) 
		{
            _SC_recommendResult(session, ref message);
		}
		
		public void _SC_recommendResult(ISession session, ref RecommendResultData message)
		{
#if ENABLE_NET_LOG || UNITY_EDITOR
            NetProtocolHelper.ClientLog(NetMessageId.centerFriend_recommendResult, "Recv->" + message.ToString());
#endif
			NetProtocolHelper.endCallRequest?.Invoke(NetMessageId.centerFriend_recommendResult, message.code);
			MsgAsyncAwaiter<RecommendResultData>.Instance.CompleteMsgAwait(ref message);
		}
		
		/// <summary>
        /// 通知添加
        /// </summary>
		protected void SC_notifyAddFriend(ISession session, List<FriendPOD> friends);
		/// <summary>
        /// 通知删除
        /// </summary>
		protected void SC_notifyDeleteFriend(ISession session, List<long> ids);
		/// <summary>
        /// 通知修改
        /// </summary>
		protected void SC_notifyUpdateFriend(ISession session, List<FriendPOD> friends);
#endregion
#region Server-side Interface
		/// <summary>
        ///  删除好友
        /// </summary>
    	public UniTask<RemoveFriendsResultData> CS_removeFriends(List<long> ids)
        {
            return _CS_removeFriends(ids);
        }
        
        public UniTask<RemoveFriendsResultData> _CS_removeFriends(List<long> ids)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(RemoveFriendsResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.centerFriend_removeFriends, "Send->"+"CenterFriend.CS_removeFriends { "
				+ "ids="
				+ ids.ToString<long>()
				+" }");
#endif
        	UniTask<RemoveFriendsResultData> task = MsgAsyncAwaiter<RemoveFriendsResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_removeFriends(ids));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.centerFriend_removeFriendsResult);
			return task;
        }
		
		public static SendPackage Pack_for_removeFriends(List<long> ids) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.centerFriend_removeFriends;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_list_long(ids);	
			return si_p;
		}
		/// <summary>
        ///  发送申请
        /// </summary>
    	public UniTask<ApplyFriendsResultData> CS_applyFriends(List<long> ids)
        {
            return _CS_applyFriends(ids);
        }
        
        public UniTask<ApplyFriendsResultData> _CS_applyFriends(List<long> ids)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(ApplyFriendsResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.centerFriend_applyFriends, "Send->"+"CenterFriend.CS_applyFriends { "
				+ "ids="
				+ ids.ToString<long>()
				+" }");
#endif
        	UniTask<ApplyFriendsResultData> task = MsgAsyncAwaiter<ApplyFriendsResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_applyFriends(ids));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.centerFriend_applyFriendsResult);
			return task;
        }
		
		public static SendPackage Pack_for_applyFriends(List<long> ids) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.centerFriend_applyFriends;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_list_long(ids);	
			return si_p;
		}
		/// <summary>
        ///  处理申请
        /// </summary>
    	public UniTask<DealWithApplyResultData> CS_dealWithApply(List<long> ids, bool allow)
        {
            return _CS_dealWithApply(ids, allow);
        }
        
        public UniTask<DealWithApplyResultData> _CS_dealWithApply(List<long> ids, bool allow)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(DealWithApplyResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.centerFriend_dealWithApply, "Send->"+"CenterFriend.CS_dealWithApply { "
				+ "ids="
				+ ids.ToString<long>()
				+ ", allow="
				+ allow
				+" }");
#endif
        	UniTask<DealWithApplyResultData> task = MsgAsyncAwaiter<DealWithApplyResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_dealWithApply(ids, allow));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.centerFriend_dealWithApplyResult);
			return task;
        }
		
		public static SendPackage Pack_for_dealWithApply(List<long> ids, bool allow) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.centerFriend_dealWithApply;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_list_long(ids);	
			_out.Write_boolean(allow);
			return si_p;
		}
		/// <summary>
        ///  添加黑名单
        /// </summary>
    	public UniTask<AddBlacklistResultData> CS_addBlacklist(long pid)
        {
            return _CS_addBlacklist(pid);
        }
        
        public UniTask<AddBlacklistResultData> _CS_addBlacklist(long pid)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(AddBlacklistResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.centerFriend_addBlacklist, "Send->"+"CenterFriend.CS_addBlacklist { "
				+ "pid="
				+ pid
				+" }");
#endif
        	UniTask<AddBlacklistResultData> task = MsgAsyncAwaiter<AddBlacklistResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_addBlacklist(pid));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.centerFriend_addBlacklistResult);
			return task;
        }
		
		public static SendPackage Pack_for_addBlacklist(long pid) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.centerFriend_addBlacklist;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_long(pid);
			return si_p;
		}
		/// <summary>
        ///  移除黑名单
        /// </summary>
    	public UniTask<RemoveBlacklistResultData> CS_removeBlacklist(List<long> ids)
        {
            return _CS_removeBlacklist(ids);
        }
        
        public UniTask<RemoveBlacklistResultData> _CS_removeBlacklist(List<long> ids)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(RemoveBlacklistResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.centerFriend_removeBlacklist, "Send->"+"CenterFriend.CS_removeBlacklist { "
				+ "ids="
				+ ids.ToString<long>()
				+" }");
#endif
        	UniTask<RemoveBlacklistResultData> task = MsgAsyncAwaiter<RemoveBlacklistResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_removeBlacklist(ids));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.centerFriend_removeBlacklistResult);
			return task;
        }
		
		public static SendPackage Pack_for_removeBlacklist(List<long> ids) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.centerFriend_removeBlacklist;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_list_long(ids);	
			return si_p;
		}
		/// <summary>
        ///  搜索玩家
        /// </summary>
    	public UniTask<SearchPlayerResultData> CS_searchPlayer(string guid)
        {
            return _CS_searchPlayer(guid);
        }
        
        public UniTask<SearchPlayerResultData> _CS_searchPlayer(string guid)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(SearchPlayerResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.centerFriend_searchPlayer, "Send->"+"CenterFriend.CS_searchPlayer { "
				+ "guid="
				+ guid
				+" }");
#endif
        	UniTask<SearchPlayerResultData> task = MsgAsyncAwaiter<SearchPlayerResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_searchPlayer(guid));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.centerFriend_searchPlayerResult);
			return task;
        }
		
		public static SendPackage Pack_for_searchPlayer(string guid) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.centerFriend_searchPlayer;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_string(guid);
			return si_p;
		}
		/// <summary>
        ///  设置备注
        /// </summary>
    	public UniTask<SetRemarkResultData> CS_setRemark(long friendId, string remark)
        {
            return _CS_setRemark(friendId, remark);
        }
        
        public UniTask<SetRemarkResultData> _CS_setRemark(long friendId, string remark)
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(SetRemarkResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.centerFriend_setRemark, "Send->"+"CenterFriend.CS_setRemark { "
				+ "friendId="
				+ friendId
				+ ", remark="
				+ remark
				+" }");
#endif
        	UniTask<SetRemarkResultData> task = MsgAsyncAwaiter<SetRemarkResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_setRemark(friendId, remark));
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.centerFriend_setRemarkResult);
			return task;
        }
		
		public static SendPackage Pack_for_setRemark(long friendId, string remark) 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.centerFriend_setRemark;
			si_p.StartWrite();
			SOutputStream _out = si_p.OutputStream;
			_out.Write_long(friendId);
			_out.Write_string(remark);
			return si_p;
		}
		/// <summary>
        ///  取得推荐
        /// </summary>
    	public UniTask<RecommendResultData> CS_recommend()
        {
            return _CS_recommend();
        }
        
        public UniTask<RecommendResultData> _CS_recommend()
        {
        	ISession session = GetSession();
        	if(session == null) return UniTask.FromResult(default(RecommendResultData));
#if ENABLE_NET_LOG || UNITY_EDITOR
			NetProtocolHelper.ClientLog(NetMessageId.centerFriend_recommend, "Send->"+"CenterFriend.CS_recommend { "
				+" }");
#endif
        	UniTask<RecommendResultData> task = MsgAsyncAwaiter<RecommendResultData>.Instance.AddMsgAwait();
        	session.SendPack(Pack_for_recommend());
        	NetProtocolHelper.beginCallRequest?.Invoke(NetMessageId.centerFriend_recommendResult);
			return task;
        }
		
		public static SendPackage Pack_for_recommend() 
		{
			SendPackage si_p = NetProtocolHelper.GetSendPackage();
			si_p.Header.Messagid = NetMessageId.centerFriend_recommend;
			si_p.StartWrite();
			return si_p;
		}
#endregion
#region Messages
        public struct RemoveFriendsResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
            }
            
            public int GetMessageId() {return NetMessageId.centerFriend_removeFriendsResult;}
            
            public override string ToString()
            {
                return "CenterFriend.removeFriendsResult"+ ", code="+ code;
            }
        }
        public struct ApplyFriendsResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
            }
            
            public int GetMessageId() {return NetMessageId.centerFriend_applyFriendsResult;}
            
            public override string ToString()
            {
                return "CenterFriend.applyFriendsResult"+ ", code="+ code;
            }
        }
        public struct DealWithApplyResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
            }
            
            public int GetMessageId() {return NetMessageId.centerFriend_dealWithApplyResult;}
            
            public override string ToString()
            {
                return "CenterFriend.dealWithApplyResult"+ ", code="+ code;
            }
        }
        public struct AddBlacklistResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
            }
            
            public int GetMessageId() {return NetMessageId.centerFriend_addBlacklistResult;}
            
            public override string ToString()
            {
                return "CenterFriend.addBlacklistResult"+ ", code="+ code;
            }
        }
        public struct RemoveBlacklistResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
            }
            
            public int GetMessageId() {return NetMessageId.centerFriend_removeBlacklistResult;}
            
            public override string ToString()
            {
                return "CenterFriend.removeBlacklistResult"+ ", code="+ code;
            }
        }
        public struct SearchPlayerResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
	        public FriendPOD friend;
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
                friend = _in.HasRemaining() ? _in.Read_pod<FriendPOD>(FriendPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.centerFriend_searchPlayerResult;}
            
            public override string ToString()
            {
                return "CenterFriend.searchPlayerResult"+ ", code="+ code+ ", friend="+ friend;
            }
        }
        public struct SetRemarkResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
	        public FriendPOD friend;
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
                friend = _in.HasRemaining() ? _in.Read_pod<FriendPOD>(FriendPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.centerFriend_setRemarkResult;}
            
            public override string ToString()
            {
                return "CenterFriend.setRemarkResult"+ ", code="+ code+ ", friend="+ friend;
            }
        }
        public struct RecommendResultData : IReceiveMessage {
        	private int? _code;
        	public int code {get{return _code == null ? -1 : (int)_code;}private set{_code = value;}}
	        public List<FriendPOD> friends;
            public bool IsFail => _code != null && _code != 0;
            public bool IsSuccess =>_code != null && _code == 0;
            public bool IsCanceled => _code == null;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                code = _in.HasRemaining() ? _in.Read_int() : default;
                friends = _in.HasRemaining() ? _in.Read_list_pod<FriendPOD>(FriendPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.centerFriend_recommendResult;}
            
            public override string ToString()
            {
                return "CenterFriend.recommendResult"+ ", code="+ code+ ", friends="+ friends.ToString<FriendPOD>();
            }
        }
        public struct NotifyAddFriendData : IReceiveMessage {
	        public List<FriendPOD> friends;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                friends = _in.HasRemaining() ? _in.Read_list_pod<FriendPOD>(FriendPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.centerFriend_notifyAddFriend;}
            
            public override string ToString()
            {
                return "CenterFriend.notifyAddFriend"+ ", friends="+ friends.ToString<FriendPOD>();
            }
        }
        public struct NotifyDeleteFriendData : IReceiveMessage {
	        public List<long> ids;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                ids = _in.HasRemaining() ? _in.Read_list_long() : default;
            }
            
            public int GetMessageId() {return NetMessageId.centerFriend_notifyDeleteFriend;}
            
            public override string ToString()
            {
                return "CenterFriend.notifyDeleteFriend"+ ", ids="+ ids.ToString<long>();
            }
        }
        public struct NotifyUpdateFriendData : IReceiveMessage {
	        public List<FriendPOD> friends;
            public void FromPackage(ReceivePackage _package)
            {
                SInputStream _in = _package.InputStream;
                friends = _in.HasRemaining() ? _in.Read_list_pod<FriendPOD>(FriendPOD.DynamicFactory) : default;
            }
            
            public int GetMessageId() {return NetMessageId.centerFriend_notifyUpdateFriend;}
            
            public override string ToString()
            {
                return "CenterFriend.notifyUpdateFriend"+ ", friends="+ friends.ToString<FriendPOD>();
            }
        }
    }
#endregion
}